/*
 * @FileName: main.c
 * @Author: GreyQiu qiushaogui@aikosolar.com
 * @Date: 2023-08-23 17:12:03
 * @LastEditors: GreyQiu qiushaogui@aikosolar.com
 * @LastEditTime: 2023-09-20 13:26:28
 * @Description: 
 * 
 * Copyright (c) 2023, All Rights Reserved. 
 */

#include "bsp.h"
#include "easy_timer.h"
#include "log.h"
#include "boot_comm.h"
#include "boot.h"


uint8_t TxBuffer1[5] = {1, 2, 3, 4, 5};
uint8_t RxBuffer1[sizeof(TxBuffer1)];

EASY_TIMER_DEF(timer_1000ms);


static void task_1000ms(void)
{
    // log_debug("->\n");
    // bsp_wifi_uart_send(TxBuffer1, 5);
} 

void task_init(void)
{
    // 1000ms任务
    easy_timer_create(timer_1000ms);
    easy_timer_start(timer_1000ms, 1000, EASY_TIMER_MODE_REPEATED, task_1000ms);
    log_debug("bootloader version: v0100 \n");
}

int main(void)
{
    bsp_wdg_init();
    FLASH_Prefetch_Buffer_Enable();
    bsp_gpio_init();
    log_init();
    boot_init();
    bsp_uart_init();
    easy_timer_init();
    boot_comm_init();
    task_init();

    while(1)
    {
        bsp_wdg_feed();
        easy_timer_execute();
    }
}
